using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;

namespace MimeCloud.WPF.Imaging
{
    public static class Reading
    {
        public static BitmapImage ReadImageFromData(byte[] data)
        {
            return ImageFromStream(new MemoryStream(data));
        }
        public static BitmapImage ReadImageFromData(string filePath)
        {
            return ImageFromStream(new FileStream(filePath,FileMode.Open,FileAccess.Read));
        }
        public static BitmapImage ImageFromStream (Stream s)
        {
            BitmapImage image = new BitmapImage();

            image.BeginInit();
            image.StreamSource = s;
            image.EndInit();

            return image;
        }
    }
}
